<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是uboot简介的相关笔记，其实之前学习STM32的时候就知道bootloader的概念，这个uboot其实就是一个bootloader，一个大型裸机程序罢了。若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV05-01-uboot-01-uboot简介">
<meta property="og:url" content="https://sumumm.github.io/post/1e314067.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是uboot简介的相关笔记，其实之前学习STM32的时候就知道bootloader的概念，这个uboot其实就是一个bootloader，一个大型裸机程序罢了。若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012163419784.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012163549350.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012164001519.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230729161725613.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730081237961.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730083002389.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730084751640.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730085002321.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730085955146.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090125413.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090210727.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090310859.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090542009.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091049354.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091327319.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091724408.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091840151.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091944569.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092052539.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092542054.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092849278.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730094501871.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730094700765.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730095317030.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730095446752.png">
<meta property="article:published_time" content="2023-09-08T11:22:51.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.040Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV05-uboot与内核">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012163419784.png">


<link rel="canonical" href="https://sumumm.github.io/post/1e314067.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/1e314067.html","path":"post/1e314067.html","title":"LV05-01-uboot-01-uboot简介"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV05-01-uboot-01-uboot简介 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81uboot%E7%AE%80%E4%BB%8B"><span class="nav-text">一、uboot简介</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81uboot%E8%8E%B7%E5%8F%96"><span class="nav-text">二、uboot获取</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-uboot%E5%AE%98%E7%BD%91"><span class="nav-text">1. uboot官网</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E8%8E%B7%E5%8F%96%E5%8E%9F%E7%89%88uboot"><span class="nav-text">2. 获取原版uboot</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%AE%98%E7%BD%91%E8%8E%B7%E5%8F%96"><span class="nav-text">2.1 官网获取</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-ftp%E4%B8%8B%E8%BD%BD"><span class="nav-text">2.2 ftp下载</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E8%8E%B7%E5%8F%96NXP%E5%8E%9F%E7%89%88uboot"><span class="nav-text">3. 获取NXP原版uboot</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E4%B8%8D%E5%90%8C%E7%9A%84uboot%E4%BB%A3%E7%A0%81"><span class="nav-text">三、不同的uboot代码</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E5%B7%A5%E7%A8%8B%E7%9B%AE%E5%BD%95"><span class="nav-text">四、工程目录</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%9C%89%E9%82%A3%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F"><span class="nav-text">1. 有那些文件？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E7%BC%96%E8%AF%91%EF%BC%9F"><span class="nav-text">2. 编译？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%9B%AE%E5%BD%95%E5%88%86%E6%9E%90"><span class="nav-text">3. 目录分析</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E6%A6%82%E8%A7%88"><span class="nav-text">3.1 概览</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-arch-%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="nav-text">3.2 arch 文件夹  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-board-%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="nav-text">3.3 board 文件夹  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-configs-%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="nav-text">3.4 configs 文件夹</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-u-boot-xxx-cmd-%E6%96%87%E4%BB%B6"><span class="nav-text">3.5 .u-boot.xxx_cmd 文件  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-Makefile-%E6%96%87%E4%BB%B6"><span class="nav-text">3.6 Makefile 文件  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-7-u-boot-xxx-%E6%96%87%E4%BB%B6"><span class="nav-text">3.7 u-boot.xxx 文件  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-8-config-%E6%96%87%E4%BB%B6"><span class="nav-text">3.8 .config 文件  </span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E5%88%9B%E5%BB%BAVScode%E5%B7%A5%E7%A8%8B"><span class="nav-text">4. 创建VScode工程</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-%E5%B1%8F%E8%94%BD%E6%96%87%E4%BB%B6%E5%92%8C%E7%9B%AE%E5%BD%95%EF%BC%9F"><span class="nav-text">4.1 屏蔽文件和目录？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-%E5%B7%A5%E4%BD%9C%E5%8C%BA%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="nav-text">4.2 工作区文件内容</span></a></li></ol></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/1e314067.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV05-01-uboot-01-uboot简介 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV05-01-uboot-01-uboot简介
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-09-08 19:22:51" itemprop="dateCreated datePublished" datetime="2023-09-08T19:22:51+08:00">2023-09-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/" itemprop="url" rel="index"><span itemprop="name">LV05-uboot与内核</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>7.1k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>26 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是uboot简介的相关笔记，其实之前学习STM32的时候就知道bootloader的概念，这个uboot其实就是一个bootloader，一个大型裸机程序罢了。若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>Windows版本</td>        <td align="left">windows11</td>    </tr>    <tr>        <td align="center">Ubuntu版本</td>        <td align="left">Ubuntu16.04的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 16 Pro</td>        <td align="left">16.2.3 build-19376536</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>      </tr>    <tr>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="4">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">在线阅读linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP linux内核仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr></table>
              </div>
            </details>

<h1 id="一、uboot简介"><a href="#一、uboot简介" class="headerlink" title="一、uboot简介"></a><font size=3>一、uboot简介</font></h1><p>Linux 系统要启动就必须需要一个 bootloader 程序，也就说芯片上电以后先运行一段 bootloader程序。这段 bootloader 程序会先初始化 DDR 等外设，然后将Linux内核从 flash（NAND、NOR FLASH、SD、MMC 等）拷贝到 DDR 中，最后启动 Linux 内核。</p>
<p> bootloader 的实际工作要复杂的多，但是它最主要的工作就是启动 Linux 内核， bootloader 和 Linux 内核的关系就像是 PC 上的 BIOS 和 Windows 的关系一样， bootloader 就相当于 BIOS。</p>
<p>目前有很多现成的 bootloader 软件可以使用，比如 U-Boot、 vivi、 RedBoot 等等，其中以 U-Boot 使用最为广泛，为了方便书写，后边的笔记会将 U-Boot 写为 uboot，毕竟是笔记，能理解就可以啦。  </p>
<p>uboot 的全称是 Universal Boot Loader， 它是一个遵循 GPL 协议的开源软件， 是一个裸机代码，我们可以将它看作是一个裸机综合例程。现在的 uboot 已经支持液晶屏、网络、 USB 等高级功能。  </p>
<h1 id="二、uboot获取"><a href="#二、uboot获取" class="headerlink" title="二、uboot获取"></a><font size=3>二、uboot获取</font></h1><h2 id="1-uboot官网"><a href="#1-uboot官网" class="headerlink" title="1. uboot官网"></a><font size=3>1. uboot官网</font></h2><p>uboot的官网在这里：<a target="_blank" rel="noopener" href="https://www.denx.de/wiki/U-Boot/">U-Boot | DENX  <i class="fa fa-external-link-alt"></i></a>，我们打开这个网页，如下图所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012163419784.png" alt="image-20221012163419784" style="zoom: 33%;" />

<p>我们点击框选出来连接便会跳转到uboot的官方文档页面：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012163549350.png" alt="image-20221012163549350" style="zoom: 28%;" />

<h2 id="2-获取原版uboot"><a href="#2-获取原版uboot" class="headerlink" title="2. 获取原版uboot"></a><font size=3>2. 获取原版uboot</font></h2><h3 id="2-1-官网获取"><a href="#2-1-官网获取" class="headerlink" title="2.1 官网获取"></a><font size=3>2.1 官网获取</font></h3><p>我们点击uboot官方文档中的<a target="_blank" rel="noopener" href="https://u-boot.readthedocs.io/en/latest/build/source.html">【Build U-Boot】&rarr;【Obtaining the source】 <i class="fa fa-external-link-alt"></i></a>，便会看到uboot的下载方式：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20221012164001519.png" alt="image-20221012164001519" style="zoom: 50%;" />

<p>其实我们也可以直接到这里选择相应的版本下载：<a target="_blank" rel="noopener" href="https://source.denx.de/u-boot/u-boot/-/tags">Tags · U-Boot &#x2F; U-Boot · GitLab (denx.de) <i class="fa fa-external-link-alt"></i></a>或者<a target="_blank" rel="noopener" href="https://github.com/u-boot/u-boot/tags">Tags · u-boot&#x2F;u-boot (github.com) <i class="fa fa-external-link-alt"></i></a></p>
<h3 id="2-2-ftp下载"><a href="#2-2-ftp下载" class="headerlink" title="2.2 ftp下载"></a><font size=3>2.2 ftp下载</font></h3><p>我们还可以通过这里下载相应版本的uboot：<a target="_blank" rel="noopener" href="https://ftp.denx.de/pub/u-boot/">Index of &#x2F;pub&#x2F;u-boot&#x2F; (denx.de) <i class="fa fa-external-link-alt"></i></a></p>
<h2 id="3-获取NXP原版uboot"><a href="#3-获取NXP原版uboot" class="headerlink" title="3. 获取NXP原版uboot"></a><font size=3>3. 获取NXP原版uboot</font></h2><p>一般来讲，我们不会直接用 uboot 官方的 U-Boot 源码的。 uboot 官方的 uboot 源码是给半导体厂商准备的，半导体厂商会下载 uboot 官方的 uboot 源码，然后将自家相应的芯片移植进去。也就是说半导体厂商会自己维护一个版本的 uboot，这个版本的 uboot 相当于是他们定制的。既然是定制的，那么肯定对自家的芯片支持会很全，虽然 uboot 官网的源码中一般也会支持他们的芯片，但是绝对是没有半导体厂商自己维护的 uboot 全面。我们可以从这里下载：<a target="_blank" rel="noopener" href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga">Release rel_imx_4.1.15_2.1.0_ga: MLK-14707 fsl_esdhc: Fix eMMC 1.8v setting issue · nxp-imx&#x2F;uboot-imx (github.com)</a> </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230729161725613.png" alt="image-20230729161725613" style="zoom:50%;" />

<p>图中的 uboot 基本支持了 NXP 当前所有可以跑 Linux 的芯片，而且支持各种启动方式，比如 EMMC、NAND、 NOR FLASH 等等，这些都是 uboot 官方所不支持的。  </p>
<h1 id="三、不同的uboot代码"><a href="#三、不同的uboot代码" class="headerlink" title="三、不同的uboot代码"></a><font size=3>三、不同的uboot代码</font></h1><table>
<thead>
<tr>
<th>uboot代码种类</th>
<th>描述</th>
</tr>
</thead>
<tbody><tr>
<td>uboot 官方的 uboot 代码</td>
<td>由 uboot 官方维护开发的 uboot 版本，版本更新快，基本包含所 有常用的芯片。</td>
</tr>
<tr>
<td>半导体厂商的 uboot 代码</td>
<td>半导体厂商维护的一个 uboot，专门针对自家的芯片，在对自家芯片支持上要比 uboot 官方的好。</td>
</tr>
<tr>
<td>开发板厂商的 uboot 代码</td>
<td>开发板厂商在半导体厂商提供的 uboot 基础上加入了对自家开发 板的支持</td>
</tr>
</tbody></table>
<h1 id="四、工程目录"><a href="#四、工程目录" class="headerlink" title="四、工程目录"></a><font size=3>四、工程目录</font></h1><h2 id="1-有那些文件？"><a href="#1-有那些文件？" class="headerlink" title="1. 有那些文件？"></a><font size=3>1. 有那些文件？</font></h2><p>我们从下载一个原版的NXP的uboot（<a target="_blank" rel="noopener" href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga">Release rel_imx_4.1.15_2.1.0_ga: MLK-14707 fsl_esdhc: Fix eMMC 1.8v setting issue · nxp-imx&#x2F;uboot-imx (github.com)</a>），方便后边移植，下载完毕后，我们会得到这样一个压缩包：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730081237961.png" alt="image-20230730081237961" style="zoom:50%;" />

<p>我们解压后，会得到如下目录及文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730083002389.png" alt="image-20230730083002389" style="zoom:50%;" />

<h2 id="2-编译？"><a href="#2-编译？" class="headerlink" title="2. 编译？"></a><font size=3>2. 编译？</font></h2><p>NXP官方是出的有一款imx6ull的evk板子，我们可以编译适配这块板子的uboot，可以使用如下命令编译，</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean</span><br><span class="line">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_evk_emmc_defconfig </span><br><span class="line">make V=0 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16</span><br></pre></td></tr></table></figure>

<p>我们可以创建一个编译脚本，方便后边使用，脚本内容如下：</p>
<details class="folding-tag" blue><summary> 点击查看编译脚本内容 </summary>
              <div class='content'>
              <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/bash</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* =====================================================</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* Copyright © hk. 2022-2025. All rights reserved.</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* File name  : 1.sh</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* Author     : 上上签</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* Date       : 2023-07-25</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">* ======================================================</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment">#</span></span></span><br><span class="line"></span><br><span class="line">SCRIPT_NAME=$&#123;0#*/&#125;</span><br><span class="line">SCRIPT_PATH=$&#123;0%/*&#125;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment">#======================================================</span></span></span><br><span class="line">BLACK=&quot;\033[1;30m&quot;</span><br><span class="line">RED=&#x27;\033[1;31m&#x27;    # 红</span><br><span class="line">GREEN=&#x27;\033[1;32m&#x27;  # 绿</span><br><span class="line">YELLOW=&#x27;\033[1;33m&#x27; # 黄</span><br><span class="line">BLUE=&#x27;\033[1;34m&#x27;   # 蓝</span><br><span class="line">PINK=&#x27;\033[1;35m&#x27;   # 紫</span><br><span class="line">CYAN=&#x27;\033[1;36m&#x27;   # 青</span><br><span class="line">WHITE=&#x27;\033[1;37m&#x27;  # 白</span><br><span class="line">CLS=&#x27;\033[0m&#x27;       # 清除颜色</span><br><span class="line"></span><br><span class="line">INFO=&quot;$&#123;GREEN&#125;INFO  $&#123;CLS&#125;&quot;</span><br><span class="line">WARN=&quot;$&#123;YELLOW&#125;WARN  $&#123;CLS&#125;&quot;</span><br><span class="line">ERR=&quot;$&#123;RED&#125;ERROR  $&#123;CLS&#125;&quot;</span><br><span class="line"></span><br><span class="line">TARGET=u-boot</span><br><span class="line">TARGET_FILE=$&#123;TARGET&#125;.bin</span><br><span class="line">SD_NODE=/dev/sdc</span><br><span class="line"></span><br><span class="line">ARCH_NAME=arm</span><br><span class="line">CROSS_COMPILE_NAME=arm-linux-gnueabihf-</span><br><span class="line">BOARD_CONFIG_NAME=mx6ull_14x14_evk_emmc_defconfig</span><br><span class="line"></span><br><span class="line">function clean_project()</span><br><span class="line">&#123;</span><br><span class="line">    make ARCH=$&#123;ARCH_NAME&#125; CROSS_COMPILE=$&#123;CROSS_COMPILE_NAME&#125; distclean</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function build_project()</span><br><span class="line">&#123;</span><br><span class="line">    if [ -f &quot;$&#123;TARGET_FILE&#125;&quot; ];then</span><br><span class="line">        echo -e &quot;$&#123;INFO&#125;正在清理工程文件...&quot;</span><br><span class="line">        clean_project</span><br><span class="line">    fi</span><br><span class="line"></span><br><span class="line">    echo -e &quot;$&#123;INFO&#125;正在配置编译选项(BOARD_CONFIG_NAME=$&#123;BOARD_CONFIG_NAME&#125;)...&quot;</span><br><span class="line">    make ARCH=$&#123;ARCH_NAME&#125; CROSS_COMPILE=$&#123;CROSS_COMPILE_NAME&#125; $&#123;BOARD_CONFIG_NAME&#125;</span><br><span class="line">    echo -e &quot;$&#123;INFO&#125;正在编译工程(BOARD_CONFIG_NAME=$&#123;BOARD_CONFIG_NAME&#125;)...&quot;</span><br><span class="line">    make V=0 ARCH=$&#123;ARCH_NAME&#125; CROSS_COMPILE=$&#123;CROSS_COMPILE_NAME&#125; -j16</span><br><span class="line"></span><br><span class="line">    echo -e &quot;$&#123;INFO&#125;检查是否编译成功...&quot;</span><br><span class="line">    if [ ! -f &quot;$&#123;TARGET_FILE&#125;&quot; ];then</span><br><span class="line">        echo -e &quot;$&#123;RED&#125;++++++++++++++++++++++++++++++++++++++++++++++++++++$&#123;CLS&#125;&quot;</span><br><span class="line">        echo -e &quot;$&#123;ERR&#125;$&#123;TARGET_FILE&#125; 编译失败,请检查后重试&quot;</span><br><span class="line">        echo -e &quot;$&#123;RED&#125;++++++++++++++++++++++++++++++++++++++++++++++++++++$&#123;CLS&#125;&quot;</span><br><span class="line">    else</span><br><span class="line">        echo -e &quot;$&#123;GREEN&#125;++++++++++++++++++++++++++++++++++++++++++++++++++++$&#123;CLS&#125;&quot;</span><br><span class="line">        echo -e &quot;$&#123;INFO&#125;$&#123;TARGET_FILE&#125; 编译成功&quot;</span><br><span class="line">        echo -e &quot;$&#123;GREEN&#125;++++++++++++++++++++++++++++++++++++++++++++++++++++$&#123;CLS&#125;&quot;</span><br><span class="line">    fi</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function download_imx()</span><br><span class="line">&#123;</span><br><span class="line">    # 判断编译目标文件是否存在</span><br><span class="line">    if [ ! -e &quot;$&#123;SD_NODE&#125;&quot; ];then</span><br><span class="line">        echo -e &quot;$&#123;ERR&#125;$&#123;SD_NODE&#125;不存在,请检查SD卡是否插入...&quot;</span><br><span class="line">        return</span><br><span class="line">    fi</span><br><span class="line">    # 检查bin文件是否存在</span><br><span class="line">    if [ ! -f &quot;$&#123;TARGET_FILE&#125;&quot; ];then</span><br><span class="line">        echo -e &quot;$&#123;ERR&#125;$&#123;TARGET_FILE&#125; 不存在,请检查后再下载...&quot;</span><br><span class="line">        return</span><br><span class="line">    fi</span><br><span class="line"></span><br><span class="line">    $&#123;IMXDOWNLOAD_TOOL&#125; $&#123;TARGET_FILE&#125; $&#123;SD_NODE&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function build_download_project()</span><br><span class="line">&#123;</span><br><span class="line">    build_project</span><br><span class="line">    download_imx</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function echo_menu()</span><br><span class="line">&#123;</span><br><span class="line">    echo &quot;=================================================&quot;</span><br><span class="line">	echo -e &quot;$&#123;GREEN&#125;               build project $&#123;CLS&#125;&quot;</span><br><span class="line">	echo -e &quot;$&#123;GREEN&#125;                by @上上签    $&#123;CLS&#125;&quot;</span><br><span class="line">	echo &quot;=================================================&quot;</span><br><span class="line">    echo -e &quot;$&#123;PINK&#125;current path       :$(pwd)$&#123;CLS&#125;&quot;</span><br><span class="line">    echo -e &quot;$&#123;PINK&#125;SCRIPT_PATH        :$&#123;SCRIPT_PATH&#125;$&#123;CLS&#125;&quot;</span><br><span class="line">    echo -e &quot;$&#123;PINK&#125;ARCH_NAME          :$&#123;ARCH_NAME&#125;$&#123;CLS&#125;&quot;</span><br><span class="line">    echo -e &quot;$&#123;PINK&#125;CROSS_COMPILE_NAME :$&#123;CROSS_COMPILE_NAME&#125;$&#123;CLS&#125;&quot;</span><br><span class="line">    echo -e &quot;$&#123;PINK&#125;BOARD_CONFIG_NAME  :$&#123;BOARD_CONFIG_NAME&#125;$&#123;CLS&#125;&quot;</span><br><span class="line">    echo &quot;&quot;</span><br><span class="line">    echo -e &quot;* [0] 编译uboot工程&quot;</span><br><span class="line">    echo -e &quot;* [1] 清理uboot工程&quot;</span><br><span class="line">    echo &quot;=================================================&quot;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function func_process()</span><br><span class="line">&#123;</span><br><span class="line">	read -p &quot;请选择功能,默认选择0:&quot; choose</span><br><span class="line">	case &quot;$&#123;choose&#125;&quot; in</span><br><span class="line">		&quot;0&quot;) build_project;;</span><br><span class="line">		&quot;1&quot;) clean_project;;</span><br><span class="line">		*) build_project;;</span><br><span class="line">	esac</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">echo_menu</span><br><span class="line">func_process</span><br></pre></td></tr></table></figure>
              </div>
            </details>

<p>编译完成后会生成一些文件，如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730084751640.png" alt="image-20230730084751640" style="zoom:50%;" />

<p>显然是要比之前多了很多的。</p>
<h2 id="3-目录分析"><a href="#3-目录分析" class="headerlink" title="3. 目录分析"></a><font size=3>3. 目录分析</font></h2><h3 id="3-1-概览"><a href="#3-1-概览" class="headerlink" title="3.1 概览"></a><font size=3>3.1 概览</font></h3><p>上边那么多目录，都有什么用？</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730085002321.png" alt="image-20230730085002321" style="zoom:50%;" />

<p>我们来分析一下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730085955146.png" alt="image-20230730085955146" style="zoom:50%;" />

<p>下面我们来分析一下其中一些后面可能会用到的文件。</p>
<h3 id="3-2-arch-文件夹"><a href="#3-2-arch-文件夹" class="headerlink" title="3.2 arch 文件夹  "></a><font size=3>3.2 arch 文件夹  </font></h3><p>这个文件夹里面存放着和架构有关的文件 ：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090125413.png" alt="image-20230730090125413" style="zoom:50%;" />

<p>比如 arm、 avr32、 m68k 等，我们现在用的是 ARM 芯片，所以只需要关心 arm 文件夹即可，打开 arm 文件夹里面内容如图 ：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090210727.png" alt="image-20230730090210727" style="zoom:50%;" />

<p>mach 开头的文件夹是跟具体的设备有关的，比如“mach-exynos”就是跟三星的 exyons 系列 CPU 有关的文件。我们使用的是 I.MX6ULL，所以要关注“imx-common”这个文件夹。另外“cpu”这个文件夹也是和 cpu 架构有关的，打开以后如图所示：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090310859.png" alt="image-20230730090310859" style="zoom:50%;" />

<p>可以看出有多种 ARM 架构相关的文件夹， I.MX6ULL 使用的 Cortex-A7 内核，Cortex-A7 属于 armv7，所以我们要关心“armv7”这个文件夹。 cpu 文件夹里面有个名为“uboot.lds”的链接脚本文件，这个就是 ARM 芯片所使用的 u-boot 链接脚本文件！ armv7 这个文件夹里面的文件都是跟 ARMV7 架构有关的是我们分析 uboot 启动源码的时候需要重点关注的。  </p>
<h3 id="3-3-board-文件夹"><a href="#3-3-board-文件夹" class="headerlink" title="3.3 board 文件夹  "></a><font size=3>3.3 board 文件夹  </font></h3><p>board 文件夹就是和具体的板子有关的，打开此文件夹，里面全是不同的板子，毫无疑问正点原子的开发板肯定也在里面(正点原子添加的)，NXP官方的评估板也在里边。 borad 文件夹里面有个名为“freescale”的文件夹：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730090542009.png" alt="image-20230730090542009" style="zoom:50%;" />

<p>有使用 freescale 芯片的板子都放到此文件夹中， I.MX 系列以前属于 freescale，只是freescale 后来被 NXP 收购了。打开此 freescale 文件夹，在里面找到和 mx6u(I.MX6UL&#x2F;ULL)有关的文件夹，如下图：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091049354.png" alt="image-20230730091049354" style="zoom:50%;" />

<p>有 5 个文件夹，这 5 个文件夹对应 5 种板子，以“mx6ul”开头的表示使用I.MX6UL 芯片的板子，以 mx6ull 开头的表示使用 I.MX6ULL 芯片的板子。mx6ullevk 是 NXP官方的I.MX6ULL开发板，正点原子的ALPHA开发板就是在这个基础上开发的。我们后面移植uboot 到时候就是参考 NXP 官方的开发板，也就是要参考 mx6ullevk 这个文件夹来定义我们的板子。</p>
<h3 id="3-4-configs-文件夹"><a href="#3-4-configs-文件夹" class="headerlink" title="3.4 configs 文件夹"></a><font size=3>3.4 configs 文件夹</font></h3><p>此文件夹为 uboot 配置文件， uboot 是可配置的，但是你要是自己从头开始一个一个项目的配置，那就太麻烦了，因此一般半导体或者开发板厂商都会制作好一个配置文件。我们可以在这个做好的配置文件基础上来添加自己想要的功能，这些半导体厂商或者开发板厂商制作好的配置文件统一命名为 “ xxx_defconfig ” ， xxx 表示开发板名字，这些 defconfig 文件都存放在 configs文件夹，因此， NXP 官方开发板的开发板配置文件肯定也在这个文件夹中  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091327319.png" alt="image-20230730091327319" style="zoom:50%;" />

<p>图中这 4 个文件中的mx6ull_14x14_evk_emmc_defconfig就是NXPimu6ull evk评估开发板所对应的 uboot 默认配置文件。使用“make xxx_defconfig”命令即可配置 uboot，比如 :</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_evk_emmc_defconfig </span><br></pre></td></tr></table></figure>

<p>上述命令就是配置NXP官方的imx6ull evk评估板所使用的 uboot。在编译 uboot 之前一定要使用 defconfig 来配置 uboot！  </p>
<h3 id="3-5-u-boot-xxx-cmd-文件"><a href="#3-5-u-boot-xxx-cmd-文件" class="headerlink" title="3.5 .u-boot.xxx_cmd 文件  "></a><font size=3>3.5 .u-boot.xxx_cmd 文件  </font></h3><p>.u-boot.xxx_cmd 是一系列的文件，这些文件都是编译生成的，都是一些命令文件，比如文件.u-boot.bin.cmd，看名字应该是和 u-boot.bin 有关的，此文件的内容如下：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091724408.png" alt="image-20230730091724408" style="zoom:50%;" />

<p>u-boot.bin.cmd 里面定义了一个变量： cmd_u-boot.bin，此变量的值为“cp u-boot-nodtb.binu-boot.bin”，也就是拷贝一份 u-boot-nodtb.bin 文件，并且重命名为 u-boot.bin，这个就是 u-boot.bin的来源，来自于文件 u-boot-nodtb.bin。  那 么 u-boot-nodtb.bin 是 怎 么 来 的 呢 ？ 文 件 .u-boot-nodtb.bin.cmd 就 是 用 于 生 成 uboot.nodtb.bin 的，此文件内容如下：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091840151.png" alt="image-20230730091840151" style="zoom:50%;" />

<p>这里用到了 arm-linux-gnueabihf-objcopy，使用 objcopy 将 ELF 格式的 u-boot 文件转换为二进制的 u-boot-nodtb.bin 文件。文件 u-boot 是 ELF 格式的文件，文件.u-boot.cmd 用于生成 u-boot，文件内容如下：    </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730091944569.png" alt="image-20230730091944569" style="zoom:50%;" />

<p>u-boot.cmd 使用到了 arm-linux-gnueabihf-ld.bfd，也就是链接工具，使用 ld.bfd 将各个 builtin.o 文件链接在一起就形成了 u-boot 文件。 uboot 在编译的时候会将同一个目录中的所有.c 文件都编译在一起，并命名为 built-in.o，相当于将众多的.c 文件对应的.o 文件集合在一起，这个就是 u-boot 文件的来源。  </p>
<p>如果我们要用 NXP 提供的 MFGTools 工具向开发板烧写 uboot，此时烧写的是 u-boot.imx文件，而不是 u-boot.bin 文件。 u-boot.imx 是在 u-boot.bin 文件的头部添加了 IVT、 DCD 等信息。这个工作是由文件.u-boot.imx.cmd 来完成的，此文件内容如下： </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092052539.png" alt="image-20230730092052539" style="zoom:50%;" />

<p>可以看出，这里用到了工具 tools&#x2F;mkimage，而 IVT、 DCD 等数据保存在了文件 board&#x2F;freescale&#x2F;mx6ullevk&#x2F;imximage.cfg.cfgtmp 中，工具 mkimage 就是读取文件 imximage-ddr512.cfg.cfgtmp 里面的信息，然后将其添加到文件 u-boot.bin 的头部，最终生成 u-boot.imx。</p>
<p>文件.u-boot.lds.cmd 就是用于生成 u-boot.lds 链接脚本的，由于.u-boot.lds.cmd 文件内容太多，这里就不列出来了。 uboot 根目录下的 u-boot.lds 链接脚本就是来源于 arch&#x2F;arm&#x2F;cpu&#x2F;u-boot.lds文件。</p>
<h3 id="3-6-Makefile-文件"><a href="#3-6-Makefile-文件" class="headerlink" title="3.6 Makefile 文件  "></a><font size=3>3.6 Makefile 文件  </font></h3><p>这个是顶层 Makefile 文件， Makefile 是支持嵌套的，也就是顶层 Makefile 可以调用子目录中的 Makefile 文件。 Makefile 嵌套在大项目中很常见，一般大项目里面所有的源代码都不会放到同一个目录中，各个功能模块的源代码都是分开的，各自存放在各自的目录中。每个功能模块目录下都有一个 Makefile，这个 Makefile 只处理本模块的编译链接工作，这样所有的编译链接工作就不用全部放到一个 Makefile 中，可以使得 Makefile 变得简洁明了。</p>
<p>uboot 源码根目录下的 Makefile 是顶层 Makefile，他会调用其它的模块的 Makefile 文件，比如 drivers&#x2F;adc&#x2F;Makefile。当然了，顶层 Makefile 要做的工作可远不止调用子目录 Makefile 这么简单。  </p>
<h3 id="3-7-u-boot-xxx-文件"><a href="#3-7-u-boot-xxx-文件" class="headerlink" title="3.7 u-boot.xxx 文件  "></a><font size=3>3.7 u-boot.xxx 文件  </font></h3><p>u-boot.xxx 同样也是一系列文件，包括 u-boot、 u-boot.bin、 u-boot.cfg、 u-boot.imx、 u-boot.lds、u-boot.map、 u-boot.srec、 u-boot.sym 和 u-boot-nodtb.bin，这些文件的含义如下：</p>
<blockquote>
<p><strong>u-boot</strong>：编译出来的 ELF 格式的 uboot 镜像文件。</p>
<p><strong>u-boot.bin</strong>：编译出来的二进制格式的 uboot 可执行镜像文件。</p>
<p><strong>u-boot.cfg</strong>： uboot 的另外一种配置文件。</p>
<p><strong>u-boot.imx</strong>： u-boot.bin 添加头部信息以后的文件， NXP 的 CPU 专用文件。</p>
<p><strong>u-boot.lds</strong>：链接脚本。</p>
<p><strong>u-boot.map</strong>： uboot 映射文件，通过查看此文件可以知道某个函数被链接到了哪个地址上。</p>
<p><strong>u-boot.srec</strong>： S-Record 格式的镜像文件。</p>
<p><strong>u-boot.sym</strong>： uboot 符号文件。</p>
<p><strong>u-boot-nodtb.bin</strong>：和 u-boot.bin 一样， u-boot.bin 就是 u-boot-nodtb.bin 的复制文件。  </p>
</blockquote>
<h3 id="3-8-config-文件"><a href="#3-8-config-文件" class="headerlink" title="3.8 .config 文件  "></a><font size=3>3.8 .config 文件  </font></h3><p>uboot 配置文件，使用命令“make xxx_defconfig”配置 uboot 以后就会自动生成， .config 内容如下：  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092542054.png" alt="image-20230730092542054" style="zoom:50%;" />

<p>可以看出.config 文件中都是以“CONFIG_”开始的配置项，这些配置项就是 Makefile 中的变量，因此后面都跟有相应的值， uboot 的顶层 Makefile 或子 Makefile 会调用这些变量值。在.config 中会有大量的变量值为‘y’，这些为‘y’的变量一般用于控制某项功能是否使能，为‘y’的话就表示功能使能，比如： </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CONFIG_CMD_BOOTM=y</span><br></pre></td></tr></table></figure>

<p>如果使能了 bootd 这个命令的话， CONFIG_CMD_BOOTM 就为‘y’。在 cmd&#x2F;Makefile 中有如下代码：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730092849278.png" alt="image-20230730092849278" style="zoom:50%;" />

<p>上边代码中有这么一句：</p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">obj-<span class="variable">$(CONFIG_CMD_BOOTM)</span> += bootm.o</span><br></pre></td></tr></table></figure>

<p>CONFIG_CMD_BOOTM&#x3D;y，将其展开就是：  </p>
<figure class="highlight makefile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">obj-y += bootm.o</span><br></pre></td></tr></table></figure>

<p>也就是给 obj-y 追加了一个“bootm.o”， obj-y 包含着所有要编译的文件对应的.o 文件，这里表示需要编译文件 cmd&#x2F;bootm.c。相当于通过 “ CONFIG_CMD_BOOTD&#x3D;y ” 来使能 bootm 这个命令，进而编译 cmd&#x2F;bootm.c 这个文件，这个文件实现了命令 bootm。在 uboot 和 Linux 内核中都是采用这种方法来选择使能某个功能，编译对应的源码文件。  </p>
<h2 id="4-创建VScode工程"><a href="#4-创建VScode工程" class="headerlink" title="4. 创建VScode工程"></a><font size=3>4. 创建VScode工程</font></h2><h3 id="4-1-屏蔽文件和目录？"><a href="#4-1-屏蔽文件和目录？" class="headerlink" title="4.1 屏蔽文件和目录？"></a><font size=3>4.1 屏蔽文件和目录？</font></h3><p>我是通过windows下的VScode的SSH插件远程登录ubuntu来进行开发，使用VScode还是比较方便的，怎么用SSH插件连接ubuntu？可以看这篇笔记《LV02-03-连接远程服务器》。然后我们可以创建一个工作区：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730094501871.png" alt="image-20230730094501871" style="zoom: 73%;" />

<p>工作区文件内容如下所示，后边会用到这个文件。</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="attr">&quot;folders&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">		<span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;path&quot;</span><span class="punctuation">:</span> <span class="string">&quot;.&quot;</span></span><br><span class="line">		<span class="punctuation">&#125;</span></span><br><span class="line">	<span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<p>然后一定要打开这个工作区，后边的操作才能生效。这样一个完整的 VSCode 工程就建立起来了。但是这个 VSCode 工程包含了 uboot 的所有文件， uboot<br>中有些文件是不需要的，比如 arch 目录下是各种架构的文件夹 ：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730094700765.png" alt="image-20230730094700765" style="zoom:50%;" />

<p>在 arch 目录下，我们只需要 arm 文件夹，所以需要将其它的目录从 VSCode 中给屏蔽掉，比如将 arch&#x2F;avr32 这个目录给屏蔽掉。我们修改工程工作区文件：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="attr">&quot;folders&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">		<span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;path&quot;</span><span class="punctuation">:</span> <span class="string">&quot;.&quot;</span></span><br><span class="line">		<span class="punctuation">&#125;</span></span><br><span class="line">	<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;settings&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="comment">// 搜索时不想显示的文件可按以下格式屏蔽(为 true 时屏蔽)</span></span><br><span class="line">		<span class="attr">&quot;search.exclude&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;arch/avr32&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line"></span><br><span class="line">		<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="comment">// 不想在工作区显示的文件可按以下格式屏蔽(为 true 时屏蔽)</span></span><br><span class="line">		<span class="attr">&quot;files.exclude&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;arch/avr32&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<p>其中”search.exclude”里面是需要在搜索结果中排除的文件或者文件夹， “files.exclude”是工程目录中需要排除的文件或者文件夹。我们需要将arch&#x2F;avr32 文件夹下的所有文件从搜索结果和左侧的工程目录中都排除掉，就可以按上边的写法，”arch&#x2F;avr32”: true，冒号前面的是要排除的文件或者文件夹，冒号后面为是否将文件排除， true 表示排除， false 表示不排除。  。我们可以看一下效果，这是屏蔽掉上边添加的内容的情况：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730095317030.png" alt="image-20230730095317030" style="zoom:50%;" />

<p>当把那两行去掉的时候，这个文件夹就会消失：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/LV05-01-uboot-01-uboot%E7%AE%80%E4%BB%8B/img/image-20230730095446752.png" alt="image-20230730095446752" style="zoom:50%;" />

<p>会发现，arch&#x2F;avr32这个目录在工程中消失了，但是文件夹其实还在，只是不在工程中，这样我们屏蔽掉一些不用的文件以及目录，阅读工程源码的时候就会很方便啦。</p>
<h3 id="4-2-工作区文件内容"><a href="#4-2-工作区文件内容" class="headerlink" title="4.2 工作区文件内容"></a><font size=3>4.2 工作区文件内容</font></h3><p>我们把不需要的文件和目录都从工作区剔除，我们在工作区文件中添加以下内容即可：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="attr">&quot;folders&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">		<span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;path&quot;</span><span class="punctuation">:</span> <span class="string">&quot;.&quot;</span></span><br><span class="line">		<span class="punctuation">&#125;</span></span><br><span class="line">	<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;settings&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="comment">// 搜索时不想显示的文件可按以下格式屏蔽(为 true 时屏蔽)</span></span><br><span class="line">		<span class="attr">&quot;search.exclude&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;**/*.o&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;**/*.su&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;**/*.cmd&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/avr32&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/blackfin&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/m68k&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/microblaze&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/mips&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/nds32&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/nios2&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/openrisc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/powerpc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sandbox&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sh&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sparc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/x86&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/mach*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm11*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm720t&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm9*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/armv7m&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/armv8&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/pxa&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/sa1100&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[a-e]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[g-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/fir*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/b*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/l*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/m5*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mp*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/c29*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/cor*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx7*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx2*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx3*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx5*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/p*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/q*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/t*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/v*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[a-l]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[n-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[a-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/m[a-w]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/m[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[a-l]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[n-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/m[a-w]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="comment">// 不想在工作区显示的文件可按以下格式屏蔽(为 true 时屏蔽)</span></span><br><span class="line">		<span class="attr">&quot;files.exclude&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;**/*.o&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;**/*.su&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;**/*.cmd&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/avr32&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/blackfin&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/m68k&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/microblaze&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/mips&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/nds32&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/nios2&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/openrisc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/powerpc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sandbox&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sh&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/sparc&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/x86&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/mach*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm11*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm720t&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/arm9*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/armv7m&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/armv8&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/pxa&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;arch/arm/cpu/sa1100&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[a-e]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[g-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/fir*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/b*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/l*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/m5*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mp*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/c29*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/cor*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx7*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx2*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx3*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/mx5*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/p*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/q*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/t*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;board/freescale/v*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[a-l]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[n-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[a-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/M[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/m[a-w]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/m[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;configs/[0-9]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[a-l]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[n-z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/[A-Z]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;include/configs/m[a-w]*&quot;</span><span class="punctuation">:</span><span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<p>上述代码用到了通配符“*”，比如“*<em>&#x2F;</em>.o”表示所有.o 结尾的文件。“configs&#x2F;[a-l]*”表示 configs 目录下所有以‘ a ’ ~ ‘ l ’开头的文件或者文件夹。 上述配置只是排除了一部分文件夹，我们在实际的使用中可以根据自己的实际需求来选择将哪些文件或者文件夹排除掉。排除以后我们的工程就会清爽很多，搜索的时候也不会跳出很多文件了。  </p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/1e314067.html">LV05-01-uboot-01-uboot简介</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年09月08日 - 19:22</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/1e314067.html" title="LV05-01-uboot-01-uboot简介">https://sumumm.github.io/post/1e314067.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV05-uboot%E4%B8%8E%E5%86%85%E6%A0%B8/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV05-uboot与内核</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/3fdc035a.html" rel="prev" title="LV05-01-uboot-02-uboot烧写">
                  <i class="fa fa-angle-left"></i> LV05-01-uboot-02-uboot烧写
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/2c9969b9.html" rel="next" title="LV07-03-openssh-移植">
                  LV07-03-openssh-移植 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
